package com.example.xlmkotlinwanandroid.base

import android.widget.Toast
import androidx.lifecycle.ViewModel
import com.example.xlmkotlinwanandroid.App
import com.example.xlmkotlinwanandroid.data.DataRepository
import com.example.xlmkotlinwanandroid.data.DataRepositorySource
import com.example.xlmkotlinwanandroid.data.remote.remotedata.RemoteData
import kotlinx.coroutines.Dispatchers
import kotlin.coroutines.CoroutineContext

abstract class BaseViewModel : ViewModel() {

    private val dataRepository: DataRepositorySource
    val remoteRepository: DataRepositorySource get() = dataRepository

    init {
        dataRepository = DataRepository(RemoteData(), Dispatchers.IO)
    }


    fun showToastMessage(msg: String) {
        Toast.makeText(App.mApp, msg, Toast.LENGTH_SHORT).show()
    }
}